const {
  buildResponse,
  successFormat,
  errorFormat,
} = require("../../utils/index");
exports.gzip = (req, res) => {
  req.headers["accept-encoding"] && res.setHeader("Content-Encoding", "gzip");
};
exports.common = (req, res) => {
  res.header("Access-Control-Allow-Methods", "PUT, GET, POST, DELETE, OPTIONS");
  res.header(
    "Access-Control-Allow-Headers",
    "Origin, Content, Content-Type, Content-Length, Authorization, Accept, X-Requested-With"
  );
  res.setHeader("Cross-origin-Embedder-Policy", "require-corp");
  res.setHeader("Cross-origin-Opener-Policy", "same-origin");
  res.setHeader("X-Frame-Options", "DENY");
  res.setHeader("X-XSS-Protection", "1; mode=block");
  res.setHeader("X-Permitted-Cross-Domain-Policies", "master-only");
  res.setHeader(
    "Content-Security-Policy",
    "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests"
  );
};
exports.buildResponse = buildResponse;
exports.successFormat = successFormat;
exports.errorFormat = errorFormat;
